package com.wmx.thread;

public class ThreadTWo extends Thread {

    private MyObject myObject;

    ThreadTWo(MyObject myObject){
        this.myObject = myObject;
    }
    @Override
    public void run() {

        synchronized (myObject){

            while (myObject.aChar<='Z'){

                try {
                    if(myObject.anInt%2!=0){
                        myObject.anInt++;
                        System.out.print((myObject.aChar));
                        myObject.aChar++;
                        myObject.notify();
                    }else {
                        myObject.wait();

                    }

                }catch (Exception e){
                    e.printStackTrace();
                }


            }
        }


    }
}
